perm filename TV.FAI[DAT,BGB] blob sn#013382 filedate 1972-11-28 generic text, type T, neo UTF8
00100	TITLE	TV
00200	COMMENT /
00300	This subroutine reads the TV camera four times at increasing clip
00400	levels, converts grey code to gray code, and adds the four four bit
00500	images and returns a sixbit image in TVBUF. /
00600		INTERN	TV
00700	; TV ROUTINE'S ARGUMENTS;
00800		EXTERN	XSAMPLE,YLINE,WIDTH,BUFCNT
00900		EXTERN	TVBUF,BUF0,BUF2,BUF4,BUF6
01000	; TV UUO ARGUMENTS;
01100		TVPTR:	0
01200		TVCLIP:	0
01300		TVYXW:	0
01400		TVERR:	0
01500	; TV ROUTINE'S VALUES RETURNED;
01600		TVTIME:	0
01700		TVDATE:	0
01800	; MAIN ENTRY;
01900	TV:	MOVEM	16,AC16#
02000		MOVEM	17,AC17#
02100	; SETUP TV UUO;
02200		SETZ	1,
02300		MOVE	YLINE
02400		ASH	1
02500		DPB	[POINT 9,1,8]
02600		MOVE	XSAMPLE
02700		DPB	[POINT 9,1,17]
02800		MOVE	WIDTH
02900		DPB	[POINT 9,1,26]
03000		MOVEM	1,TVYXW
     

00100	; INIT THE TV CAMERA;
00200		INIT	17,17
00300		SIXBIT/TV/
00400		0
00500		JRST	[OUTSTR[ASCIZ/CAN'T INIT TV./]↔INCHRW↔JRST .-3]
00600	; DO FOUR INPUTS IN A ROW;
00700		OUTSTR[ASCIZ/TV READY./]
00800		SETZ	1,
00900		MOVNI	=6912
01000		HRLZM	TVPTR
01100		DEFINE	TVCALL(CLIPS,BUFADR)
01200	{	MOVE	BUFADR
01300		HRRM	TVPTR
01400		MOVEI	CLIPS
01500		MOVEM	TVCLIP
01600		SETZM	TVERR
01700		INPUT	17,TVPTR
01800		MOVE	1,TVERR
01850		TRNE	1,100060
01875		JRST	.-4}
01900		TVCALL	(100002,BUF0)
02000		TVCALL	(320002,BUF2)
02100		TVCALL	(540002,BUF4)
02200		TVCALL	(760002,BUF6)
02300		OUTSTR[ASCIZ/TV DONE.
02400	/]
02500		RELEASE	17,
     

00100	; REPORT ON THE ERROR BITS AND RETAKE IF NECESSARY;
00200		TRNE	1,100000	↔	OUTSTR [ASCIZ/TV PARITY ERROR.
00300	/]↔	TRNE	1,40		↔	OUTSTR [ASCIZ/TV DATA MISS.
00400	/]↔	TRNE	1,20		↔	OUTSTR [ASCIZ/TV NON EX MEM.
00500	/]↔	TRNE	1,100060	↔	JRST TV+2
00600	; TIME AND DATE.
00700		CALLI	22
00800		MOVEM	TVTIME
00900		CALLI	14
01000		MOVEM	TVDATE
01100	; CONVERT FROM GREY CODE TO GRAY CODE.
01200		HRLZI	16,[
01300			SETCM	17,(16)		;0
01400			MOVE	15,17		;1
01500			LSH	15,-1		;2
01600			AND	15,13		;3
01700			XORB	17,15		;4
01800			LSH	15,-2		;5
01900			AND	15,14		;6
02000			XOR	17,15		;7
02100			MOVEM	17,(16)		;10
02200			AOBJN	16,		;11
02300			JRST			;12
02400			BYTE (4)7,7,7,7,7,7,7,7,7
02500			BYTE (4)3,3,3,3,3,3,3,3,3
02600			]
02700		BLT	16,14
02800		HLLZ	16,TVPTR
02900		HRR	16,BUF0
03000		HRRI	12,.+2
03100		JRST
03200		HLLZ	16,TVPTR
03300		HRR	16,BUF2
03400		HRRI	12,.+2
03500		JRST
03600		HLLZ	16,TVPTR
03700		HRR	16,BUF4
03800		HRRI	12,.+2
03900		JRST
04000		HLLZ	16,TVPTR
04100		HRR	16,BUF6
04200		HRRI	12,.+2
04300		JRST
     

00100	; IMAGE SUMMATION MACRO;
00200		OUTPTR	←	4
00300		INPTR	←	5
00400		DEFINE	TVADD (BUF,OP)
00500	{	MOVE	INPTR,	BUF
00600		MOVE	OUTPTR,	TVBUF
00700		MOVEI	2,	=3456
00800		JSP	3,	.+1
00900		SETZ
01000		MOVE 1,(INPTR)↔ AOS INPTR
01100		ROTC 4↔ ROT 2
01200		ROTC 4↔ ROT 2
01300		ROTC 4↔ ROT 2
01400		ROTC 4↔ ROT 2
01500		ROTC 4↔ ROT 2
01600		ROTC 4↔
01700		OP (OUTPTR)↔ AOS OUTPTR↔ SETZ
01800		ROTC 4↔ ROT 2
01900		ROTC 4↔ ROT 2
02000		ROTC 4↔ ROT 2
02100		MOVE 1,(INPTR)↔ AOS INPTR
02200		ROTC 4↔ ROT 2
02300		ROTC 4↔ ROT 2
02400		ROTC 4↔
02500		OP (OUTPTR)↔ AOS OUTPTR↔ SETZ
02600		ROTC 4↔ ROT 2
02700		ROTC 4↔ ROT 2
02800		ROTC 4↔ ROT 2
02900		ROTC 4↔ ROT 2
03000		ROTC 4↔ ROT 2
03100		ROTC 4↔
03200		OP (OUTPTR)↔ AOS OUTPTR
03300		SOJG	2,(3)
03400	}
03500	
03600	; DO THE IMAGE SUMMATION.
03700		TVADD	(BUF0,MOVEM)
03800		TVADD	(BUF2,ADDM)
03900		TVADD	(BUF4,ADDM)
04000		TVADD	(BUF6,ADDM)
04100	; RETURN TO SAIL.
04200		MOVE	16,AC16
04300		MOVE	17,AC17
04400		POPJ	17,
04500	END